package cate.game.play.vo;

import cate.game.play.proce.play.PlayPO;
import cate.game.play.proce.play.PlayStory;
import cate.game.play.proce.round.RoundPO;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.ArrayList;
import java.util.List;

@NoteClass("剧本VO")
public class PlayVO {

	@NoteField("剧本唯一id")
	public String uid;

	@NoteField("最大回合数")
	public int roundMax;

	@NoteField("回合数据")
	public List<RoundPO> rounds = new ArrayList<>();

	@NoteField("队伍的开局状态记录")
	public TeamVSVO teamBegin;

	@NoteField("A方信息")
	public PlaySideVO side1;

	@NoteField("B方信息")
	public PlaySideVO side2;

	@NoteField("统计数据")
	public FightStatVO stat;

	@NoteField("剧本故事")
	public PlayStory story;

	@NoteField("胜利方")
	public byte winner;

	@NoteField("开始播放的时间戳")
	public long startTime;

	@NoteField("结束播放的时间戳")
	public long endTime;

	public PlayVO() {
	}

	public PlayVO read(PlayPO play) {
		this.uid = play.uid;
		this.roundMax = play.roundMax;
		this.rounds = play.rounds;
		this.teamBegin = new TeamVSVO().read(play.teamBegin);
		this.side1 = new PlaySideVO().read(play.a);
		this.side2 = new PlaySideVO().read(play.b);
		this.stat = new FightStatVO().read(play.teamEnd);
		this.story = play.story;
		this.winner = play.winner;
		this.startTime = play.startTime;
		this.endTime = play.endTime;
		return this;
	}
}
